<?php

/**
 * vip大客户
 */

define('IN_ECS', true);

require(dirname(__FILE__) . '/includes/init.php');

/**
 * 提交留言
 */
if($_REQUEST['act']=='act_insert'){
    $username = isset($_POST['username']) ? trim($_POST['username']) : '';
    $phone = isset($_POST['phone']) ? trim($_POST['phone']) : '';
    $content = isset($_POST['content']) ? trim($_POST['content']) : '';

    /* 验证码检查 */
    if ((intval($_CFG['captcha']) & CAPTCHA_REGISTER) && gd_version() > 0)
    {
        if (empty($_POST['captcha']))
        {
            show_message($_LANG['invalid_captcha'], '返回前一页', 'vip.php', 'warning');
        }

        /* 检查验证码 */
        include_once('includes/cls_captcha.php');

        $validator = new captcha();
        if (!$validator->check_word($_POST['captcha']))
        {
            show_message($_LANG['invalid_captcha'], '返回前一页', 'vip.php', 'warning');
        }
    }

    $sql = 'insert into '. $GLOBALS['ecs']->table('vips') . 'set username = "'.htmlspecialchars($username).'",phone = "'.htmlspecialchars($phone).'",content = "'.$content.'",create_time = unix_timestamp()';
    $flag = $GLOBALS['db']->query($sql);
    if(!$flag){
        show_message('操作异常', '返回前一页', 'vip.php', 'warning');
    }else{
        show_message('感谢您提交信息，我们会及时与您取得联系，谢谢！', '前往首页', 'vip.php', 'info');
    }
}

assign_template();
$smarty->assign('script_name', 'vip');
$smarty->display('vip.dwt');

?>